#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@author: yuejl
@application:
@contact: lewyuejian@163.com
@file: get_token.py
@time: 2021/3/20 0020 22:37
@desc:获取token
'''

from wechatapi.client import HttpRequest
from wechatapi.parser import parser_yaml_data, parser_testcase_entries
from wechatapi.takes import use_mapping
class WeChat:

    yaml_data = r"D:\CodeBase\auto\WechatApi\wechatapi\data\testdatas\test_get_access_token.yaml"

    params = parser_yaml_data(yaml_data, 'access_token')
    data = parser_testcase_entries(params)

    @use_mapping('access_token')
    def get_token(self):
        resp = HttpRequest().visit_request_api(self.data)
        return resp

if __name__ == '__main__':
    a = WeChat().get_token()
    print(a)
